/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "esta", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Esta.findAll", query = "SELECT e FROM Esta e"),
    @NamedQuery(name = "Esta.findByEstaId", query = "SELECT e FROM Esta e WHERE e.estaId = :estaId"),
    @NamedQuery(name = "Esta.findByEstacodi", query = "SELECT e FROM Esta e WHERE e.estacodi = :estacodi"),
    @NamedQuery(name = "Esta.findByEstanomb", query = "SELECT e FROM Esta e WHERE e.estanomb = :estanomb"),
    @NamedQuery(name = "Esta.findByEstadire", query = "SELECT e FROM Esta e WHERE e.estadire = :estadire"),
    @NamedQuery(name = "Esta.findByEstaarea", query = "SELECT e FROM Esta e WHERE e.estaarea = :estaarea"),
    @NamedQuery(name = "Esta.findByEstaobse", query = "SELECT e FROM Esta e WHERE e.estaobse = :estaobse"),
    @NamedQuery(name = "Esta.findByEstaesta", query = "SELECT e FROM Esta e WHERE e.estaesta = :estaesta"),
    @NamedQuery(name = "Esta.findByEstauing", query = "SELECT e FROM Esta e WHERE e.estauing = :estauing"),
    @NamedQuery(name = "Esta.findByEstafing", query = "SELECT e FROM Esta e WHERE e.estafing = :estafing"),
    @NamedQuery(name = "Esta.findByEstaumod", query = "SELECT e FROM Esta e WHERE e.estaumod = :estaumod"),
    @NamedQuery(name = "Esta.findByEstafmod", query = "SELECT e FROM Esta e WHERE e.estafmod = :estafmod")})
public class Esta implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "esta__id")
    private Integer estaId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 8)
    @Column(name = "estacodi")
    private String estacodi;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "estanomb")
    private String estanomb;
    @Size(max = 2147483647)
    @Column(name = "estadire")
    private String estadire;
    @Column(name = "estaarea")
    private BigInteger estaarea;
    @Size(max = 2147483647)
    @Column(name = "estaobse")
    private String estaobse;
    @Lob
    @Column(name = "estaimgn")
    private byte[] estaimgn;
    @Lob
    @Column(name = "estaimgs")
    private byte[] estaimgs;
    @Lob
    @Column(name = "estaimge")
    private byte[] estaimge;
    @Lob
    @Column(name = "estaimgo")
    private byte[] estaimgo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estaesta")
    private boolean estaesta;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "estauing")
    private String estauing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estafing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date estafing;
    @Size(max = 20)
    @Column(name = "estaumod")
    private String estaumod;
    @Column(name = "estafmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date estafmod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estaId")
    private Collection<Cain> cainCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estaId")
    private Collection<Cfges> cfgesCollection;
    @OneToMany(mappedBy = "estaId")
    private Collection<Prpm> prpmCollection;
    @JoinColumn(name = "proes__id", referencedColumnName = "proes__id")
    @ManyToOne
    private Proes proesId;
    @JoinColumn(name = "parr__id", referencedColumnName = "parr__id")
    @ManyToOne(optional = false)
    private Parr parrId;
    @JoinColumn(name = "maces__id", referencedColumnName = "maces__id")
    @ManyToOne(optional = false)
    private Maces macesId;
    @JoinColumn(name = "este__id", referencedColumnName = "este__id")
    @ManyToOne(optional = false)
    private Este esteId;
    @JoinColumn(name = "cuen__id", referencedColumnName = "cuen__id")
    @ManyToOne(optional = false)
    private Cuen cuenId;
    @JoinColumn(name = "acces__id", referencedColumnName = "acces__id")
    @ManyToOne(optional = false)
    private Acces accesId;

    public Esta() {
    }

    public Esta(Integer estaId) {
        this.estaId = estaId;
    }

    public Esta(Integer estaId, String estacodi, String estanomb, boolean estaesta, String estauing, Date estafing) {
        this.estaId = estaId;
        this.estacodi = estacodi;
        this.estanomb = estanomb;
        this.estaesta = estaesta;
        this.estauing = estauing;
        this.estafing = estafing;
    }

    public Integer getEstaId() {
        return estaId;
    }

    public void setEstaId(Integer estaId) {
        Integer oldEstaId = this.estaId;
        this.estaId = estaId;
        changeSupport.firePropertyChange("estaId", oldEstaId, estaId);
    }

    public String getEstacodi() {
        return estacodi;
    }

    public void setEstacodi(String estacodi) {
        String oldEstacodi = this.estacodi;
        this.estacodi = estacodi;
        changeSupport.firePropertyChange("estacodi", oldEstacodi, estacodi);
    }

    public String getEstanomb() {
        return estanomb;
    }

    public void setEstanomb(String estanomb) {
        String oldEstanomb = this.estanomb;
        this.estanomb = estanomb;
        changeSupport.firePropertyChange("estanomb", oldEstanomb, estanomb);
    }

    public String getEstadire() {
        return estadire;
    }

    public void setEstadire(String estadire) {
        String oldEstadire = this.estadire;
        this.estadire = estadire;
        changeSupport.firePropertyChange("estadire", oldEstadire, estadire);
    }

    public BigInteger getEstaarea() {
        return estaarea;
    }

    public void setEstaarea(BigInteger estaarea) {
        BigInteger oldEstaarea = this.estaarea;
        this.estaarea = estaarea;
        changeSupport.firePropertyChange("estaarea", oldEstaarea, estaarea);
    }

    public String getEstaobse() {
        return estaobse;
    }

    public void setEstaobse(String estaobse) {
        String oldEstaobse = this.estaobse;
        this.estaobse = estaobse;
        changeSupport.firePropertyChange("estaobse", oldEstaobse, estaobse);
    }

    public byte[] getEstaimgn() {
        return estaimgn;
    }

    public void setEstaimgn(byte[] estaimgn) {
        byte[] oldEstaimgn = this.estaimgn;
        this.estaimgn = estaimgn;
        changeSupport.firePropertyChange("estaimgn", oldEstaimgn, estaimgn);
    }

    public byte[] getEstaimgs() {
        return estaimgs;
    }

    public void setEstaimgs(byte[] estaimgs) {
        byte[] oldEstaimgs = this.estaimgs;
        this.estaimgs = estaimgs;
        changeSupport.firePropertyChange("estaimgs", oldEstaimgs, estaimgs);
    }

    public byte[] getEstaimge() {
        return estaimge;
    }

    public void setEstaimge(byte[] estaimge) {
        byte[] oldEstaimge = this.estaimge;
        this.estaimge = estaimge;
        changeSupport.firePropertyChange("estaimge", oldEstaimge, estaimge);
    }

    public byte[] getEstaimgo() {
        return estaimgo;
    }

    public void setEstaimgo(byte[] estaimgo) {
        byte[] oldEstaimgo = this.estaimgo;
        this.estaimgo = estaimgo;
        changeSupport.firePropertyChange("estaimgo", oldEstaimgo, estaimgo);
    }

    public boolean getEstaesta() {
        return estaesta;
    }

    public void setEstaesta(boolean estaesta) {
        boolean oldEstaesta = this.estaesta;
        this.estaesta = estaesta;
        changeSupport.firePropertyChange("estaesta", oldEstaesta, estaesta);
    }

    public String getEstauing() {
        return estauing;
    }

    public void setEstauing(String estauing) {
        String oldEstauing = this.estauing;
        this.estauing = estauing;
        changeSupport.firePropertyChange("estauing", oldEstauing, estauing);
    }

    public Date getEstafing() {
        return estafing;
    }

    public void setEstafing(Date estafing) {
        Date oldEstafing = this.estafing;
        this.estafing = estafing;
        changeSupport.firePropertyChange("estafing", oldEstafing, estafing);
    }

    public String getEstaumod() {
        return estaumod;
    }

    public void setEstaumod(String estaumod) {
        String oldEstaumod = this.estaumod;
        this.estaumod = estaumod;
        changeSupport.firePropertyChange("estaumod", oldEstaumod, estaumod);
    }

    public Date getEstafmod() {
        return estafmod;
    }

    public void setEstafmod(Date estafmod) {
        Date oldEstafmod = this.estafmod;
        this.estafmod = estafmod;
        changeSupport.firePropertyChange("estafmod", oldEstafmod, estafmod);
    }

    @XmlTransient
    public Collection<Cain> getCainCollection() {
        return cainCollection;
    }

    public void setCainCollection(Collection<Cain> cainCollection) {
        this.cainCollection = cainCollection;
    }

    @XmlTransient
    public Collection<Cfges> getCfgesCollection() {
        return cfgesCollection;
    }

    public void setCfgesCollection(Collection<Cfges> cfgesCollection) {
        this.cfgesCollection = cfgesCollection;
    }

    @XmlTransient
    public Collection<Prpm> getPrpmCollection() {
        return prpmCollection;
    }

    public void setPrpmCollection(Collection<Prpm> prpmCollection) {
        this.prpmCollection = prpmCollection;
    }

    public Proes getProesId() {
        return proesId;
    }

    public void setProesId(Proes proesId) {
        Proes oldProesId = this.proesId;
        this.proesId = proesId;
        changeSupport.firePropertyChange("proesId", oldProesId, proesId);
    }

    public Parr getParrId() {
        return parrId;
    }

    public void setParrId(Parr parrId) {
        Parr oldParrId = this.parrId;
        this.parrId = parrId;
        changeSupport.firePropertyChange("parrId", oldParrId, parrId);
    }

    public Maces getMacesId() {
        return macesId;
    }

    public void setMacesId(Maces macesId) {
        Maces oldMacesId = this.macesId;
        this.macesId = macesId;
        changeSupport.firePropertyChange("macesId", oldMacesId, macesId);
    }

    public Este getEsteId() {
        return esteId;
    }

    public void setEsteId(Este esteId) {
        Este oldEsteId = this.esteId;
        this.esteId = esteId;
        changeSupport.firePropertyChange("esteId", oldEsteId, esteId);
    }

    public Cuen getCuenId() {
        return cuenId;
    }

    public void setCuenId(Cuen cuenId) {
        Cuen oldCuenId = this.cuenId;
        this.cuenId = cuenId;
        changeSupport.firePropertyChange("cuenId", oldCuenId, cuenId);
    }

    public Acces getAccesId() {
        return accesId;
    }

    public void setAccesId(Acces accesId) {
        Acces oldAccesId = this.accesId;
        this.accesId = accesId;
        changeSupport.firePropertyChange("accesId", oldAccesId, accesId);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (estaId != null ? estaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Esta)) {
            return false;
        }
        Esta other = (Esta) object;
        if ((this.estaId == null && other.estaId != null) || (this.estaId != null && !this.estaId.equals(other.estaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return estacodi+ " " +estanomb;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
